package cn.com.nr.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import cn.com.common.constants.Constants;
import cn.com.common.result.DataResult;
import cn.com.gas.entity.GasStationinfoEntity;
import cn.com.gas.service.GasStationinfoService;
import cn.com.nr.entity.NrConcreteEndangerEntity;
import cn.com.nr.entity.NrDiggingsEndangerEntity;
import cn.com.nr.entity.NrRecordsEntity;
import cn.com.nr.service.NrConcreteEndangerService;
import cn.com.nr.service.NrDiggingsEndangerService;
import cn.com.nr.service.NrRecordsService;
import cn.com.system.entity.SysDept;
import cn.com.system.service.DeptService;
import cn.com.system.service.impl.HttpSessionService;
import cn.com.util.TsBqUtils;

/**
 * 自然资源采集记录
 *
 * @author shaochangyang
 * @email l2l84o7o5@live.com
 * @date 2025-02-08 16:34:41
 */
@Controller
@RequestMapping("/nr/records")
public class NrRecordsController {
	@Autowired
	private NrRecordsService nrRecordsService;
	@Autowired
	private HttpSessionService httpSessionService;
	
	@Autowired
	private NrDiggingsEndangerService nrDiggingsEndangerService;
	@Autowired
	private NrConcreteEndangerService nrConcreteEndangerService;
	@Autowired
	private GasStationinfoService gasStationinfoService;
	
	@Autowired
	private DeptService deptService;
	
	@ApiOperation(value = "删除")
	@DeleteMapping("/delete")
	@ResponseBody
	public DataResult delete(@RequestBody @ApiParam(value = "id集合") List<String> ids) {
		nrRecordsService.removeByIds(ids);
		return DataResult.success();
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@ApiOperation(value = "查询分页数据(升降机)")
	@PostMapping("/listByOrelifter")
	@ResponseBody
	public DataResult listByOrelifter(@RequestBody NrRecordsEntity nrRecords) throws ParseException {

		String currentDeptId = httpSessionService.getCurrentDeptId();

		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

		String deptId = nrRecords.getDeptId();
		String stationName = nrRecords.getStationName();

		LambdaQueryWrapper<NrDiggingsEndangerEntity> queryWrapperStationinfo = Wrappers.lambdaQuery();
		if (TsBqUtils.isNotNull(deptId)) {
			queryWrapperStationinfo.eq(NrDiggingsEndangerEntity::getTaxorgcode, deptId);
		} else {
			if (Constants.TAX_COUNTES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 县区局
				queryWrapperStationinfo.eq(NrDiggingsEndangerEntity::getTaxorgcode, currentDeptId);

			} else if (Constants.TAX_CITIES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 市局
				queryWrapperStationinfo.like(NrDiggingsEndangerEntity::getTaxorgcode, currentDeptId.substring(0, 5));
			} else {
				// 省局
			}
		}

		if (TsBqUtils.isNotNull(stationName)) {
			queryWrapperStationinfo.like(NrDiggingsEndangerEntity::getName, stationName);
		}
		
		List<NrDiggingsEndangerEntity> listNr = nrDiggingsEndangerService.list(queryWrapperStationinfo);
		
		List<String> nrIdList = new ArrayList<>();
		
		for (NrDiggingsEndangerEntity nr : listNr) {
			String id = nr.getId();
			nrIdList.add(id);
		}
		
		if (TsBqUtils.isNotNull(nrIdList)) {
			Page page = new Page(nrRecords.getPage(), nrRecords.getLimit());
			LambdaQueryWrapper<NrRecordsEntity> queryWrapper = Wrappers.lambdaQuery();
			// 查询条件示例
			
			if (!StringUtils.isEmpty(nrRecords.getCreateTimeStart())) {
				queryWrapper.ge(NrRecordsEntity::getTime,
						sdf.parse(nrRecords.getCreateTimeStart() + " 00:00:00"));
			}
			if (!StringUtils.isEmpty(nrRecords.getCreateTimeEnd())) {
				queryWrapper.le(NrRecordsEntity::getTime,
						sdf.parse(nrRecords.getCreateTimeEnd() + " 23:59:59"));
			}

			queryWrapper.eq(NrRecordsEntity::getMessageRulename, "升降机");
			
			queryWrapper.in(NrRecordsEntity::getNrEndanger, nrIdList);
			
			queryWrapper.orderByDesc(NrRecordsEntity::getTime);

			IPage<NrRecordsEntity> iPage = nrRecordsService.page(page, queryWrapper);
			List<NrRecordsEntity> records = iPage.getRecords();
			for (NrRecordsEntity nrRecordsEntity : records) {
				String nrEndanger = nrRecordsEntity.getNrEndanger();
				NrDiggingsEndangerEntity diggingsEndangerEntity = nrDiggingsEndangerService.getById(nrEndanger);
				if(TsBqUtils.isNotNull(diggingsEndangerEntity)){
					
					String diggingsEndangerName = diggingsEndangerEntity.getName();
					nrRecordsEntity.setStation(diggingsEndangerName);
					
					String taxorgcode = diggingsEndangerEntity.getTaxorgcode();
					SysDept sysDept = deptService.getById(taxorgcode);
					
					if(TsBqUtils.isNotNull(sysDept)){
						String name = sysDept.getName();
						nrRecordsEntity.setDeptName(name);
					}
					String taxpayerCode = diggingsEndangerEntity.getTaxpayerCode();
					nrRecordsEntity.setTaxpayerCode(taxpayerCode);
				}
			}
			return DataResult.success(iPage);
		}else{
			return DataResult.fail("暂无分析矿山业务数据");
		}
	}
	
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@ApiOperation(value = "查询分页数据(运煤车)")
	@PostMapping("/listByOrecar")
	@ResponseBody
	public DataResult listByOrecar(@RequestBody NrRecordsEntity nrRecords) throws ParseException {

		String currentDeptId = httpSessionService.getCurrentDeptId();

		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

		String deptId = nrRecords.getDeptId();
		String stationName = nrRecords.getStationName();

		LambdaQueryWrapper<NrDiggingsEndangerEntity> queryWrapperStationinfo = Wrappers.lambdaQuery();
		if (TsBqUtils.isNotNull(deptId)) {
			queryWrapperStationinfo.eq(NrDiggingsEndangerEntity::getTaxorgcode, deptId);
		} else {
			if (Constants.TAX_COUNTES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 县区局
				queryWrapperStationinfo.eq(NrDiggingsEndangerEntity::getTaxorgcode, currentDeptId);

			} else if (Constants.TAX_CITIES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 市局
				queryWrapperStationinfo.like(NrDiggingsEndangerEntity::getTaxorgcode, currentDeptId.substring(0, 5));
			} else {
				// 省局
			}
		}

		if (TsBqUtils.isNotNull(stationName)) {
			queryWrapperStationinfo.like(NrDiggingsEndangerEntity::getName, stationName);
		}
		
		List<NrDiggingsEndangerEntity> listNr = nrDiggingsEndangerService.list(queryWrapperStationinfo);
		
		List<String> nrIdList = new ArrayList<>();
		
		for (NrDiggingsEndangerEntity nr : listNr) {
			String id = nr.getId();
			nrIdList.add(id);
		}
		
		if (TsBqUtils.isNotNull(nrIdList)) {
			Page page = new Page(nrRecords.getPage(), nrRecords.getLimit());
			LambdaQueryWrapper<NrRecordsEntity> queryWrapper = Wrappers.lambdaQuery();
			// 查询条件示例
			
			if (!StringUtils.isEmpty(nrRecords.getCreateTimeStart())) {
				queryWrapper.ge(NrRecordsEntity::getTime,
						sdf.parse(nrRecords.getCreateTimeStart() + " 00:00:00"));
			}
			if (!StringUtils.isEmpty(nrRecords.getCreateTimeEnd())) {
				queryWrapper.le(NrRecordsEntity::getTime,
						sdf.parse(nrRecords.getCreateTimeEnd() + " 23:59:59"));
			}

			queryWrapper.eq(NrRecordsEntity::getMessageRulename, "运煤车");
			
			queryWrapper.in(NrRecordsEntity::getNrEndanger, nrIdList);
			
			queryWrapper.orderByDesc(NrRecordsEntity::getTime);

			IPage<NrRecordsEntity> iPage = nrRecordsService.page(page, queryWrapper);
			List<NrRecordsEntity> records = iPage.getRecords();
			for (NrRecordsEntity nrRecordsEntity : records) {
				String nrEndanger = nrRecordsEntity.getNrEndanger();
				NrDiggingsEndangerEntity diggingsEndangerEntity = nrDiggingsEndangerService.getById(nrEndanger);
				if(TsBqUtils.isNotNull(diggingsEndangerEntity)){
					String diggingsEndangerName = diggingsEndangerEntity.getName();
					nrRecordsEntity.setStation(diggingsEndangerName);
					
					String taxorgcode = diggingsEndangerEntity.getTaxorgcode();
					SysDept sysDept = deptService.getById(taxorgcode);
					
					if(TsBqUtils.isNotNull(sysDept)){
						String name = sysDept.getName();
						nrRecordsEntity.setDeptName(name);
					}
					String taxpayerCode = diggingsEndangerEntity.getTaxpayerCode();
					nrRecordsEntity.setTaxpayerCode(taxpayerCode);
				}
			}
			return DataResult.success(iPage);
		}else{
			return DataResult.fail("暂无分析矿山业务数据");
		}
	}
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@ApiOperation(value = "查询分页数据(水泥车)")
	@PostMapping("/listByCretecar")
	@ResponseBody
	public DataResult listByCretecar(@RequestBody NrRecordsEntity nrRecords) throws ParseException {

		String currentDeptId = httpSessionService.getCurrentDeptId();

		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

		String deptId = nrRecords.getDeptId();
		String stationName = nrRecords.getStationName();

		LambdaQueryWrapper<NrConcreteEndangerEntity> queryWrapperStationinfo = Wrappers.lambdaQuery();
		if (TsBqUtils.isNotNull(deptId)) {
			queryWrapperStationinfo.eq(NrConcreteEndangerEntity::getTaxorgcode, deptId);
		} else {
			if (Constants.TAX_COUNTES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 县区局
				queryWrapperStationinfo.eq(NrConcreteEndangerEntity::getTaxorgcode, currentDeptId);

			} else if (Constants.TAX_CITIES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 市局
				queryWrapperStationinfo.like(NrConcreteEndangerEntity::getTaxorgcode, currentDeptId.substring(0, 5));
			} else {
				// 省局
			}
		}

		if (TsBqUtils.isNotNull(stationName)) {
			queryWrapperStationinfo.like(NrConcreteEndangerEntity::getName, stationName);
		}
		
		List<NrConcreteEndangerEntity> listNr = nrConcreteEndangerService.list(queryWrapperStationinfo);
		
		List<String> nrIdList = new ArrayList<>();
		
		for (NrConcreteEndangerEntity nr : listNr) {
			String id = nr.getId();
			nrIdList.add(id);
		}
		
		if (TsBqUtils.isNotNull(nrIdList)) {
			Page page = new Page(nrRecords.getPage(), nrRecords.getLimit());
			LambdaQueryWrapper<NrRecordsEntity> queryWrapper = Wrappers.lambdaQuery();
			// 查询条件示例
			
			if (!StringUtils.isEmpty(nrRecords.getCreateTimeStart())) {
				queryWrapper.ge(NrRecordsEntity::getTime,
						sdf.parse(nrRecords.getCreateTimeStart() + " 00:00:00"));
			}
			if (!StringUtils.isEmpty(nrRecords.getCreateTimeEnd())) {
				queryWrapper.le(NrRecordsEntity::getTime,
						sdf.parse(nrRecords.getCreateTimeEnd() + " 23:59:59"));
			}

			queryWrapper.eq(NrRecordsEntity::getMessageRulename, "水泥车");
			
			queryWrapper.in(NrRecordsEntity::getNrEndanger, nrIdList);
			
			queryWrapper.orderByDesc(NrRecordsEntity::getTime);

			IPage<NrRecordsEntity> iPage = nrRecordsService.page(page, queryWrapper);
			List<NrRecordsEntity> records = iPage.getRecords();
			for (NrRecordsEntity nrRecordsEntity : records) {
				String nrEndanger = nrRecordsEntity.getNrEndanger();
				NrConcreteEndangerEntity concreteEndangerEntity = nrConcreteEndangerService.getById(nrEndanger);
				if(TsBqUtils.isNotNull(concreteEndangerEntity)){
					
					String diggingsEndangerName = concreteEndangerEntity.getName();
					
					nrRecordsEntity.setStation(diggingsEndangerName);
					
					String taxorgcode = concreteEndangerEntity.getTaxorgcode();
					
					SysDept sysDept = deptService.getById(taxorgcode);
					
					if(TsBqUtils.isNotNull(sysDept)){
						String name = sysDept.getName();
						nrRecordsEntity.setDeptName(name);
					}
					String taxpayerCode = concreteEndangerEntity.getTaxpayerCode();
					nrRecordsEntity.setTaxpayerCode(taxpayerCode);
				}
			}
			return DataResult.success(iPage);
		}else{
			return DataResult.fail("暂无分析混凝土业务数据");
		}
	}
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@ApiOperation(value = "查询分页数据(转轮)")
	@PostMapping("/listByOrerunner")
	@ResponseBody
	public DataResult listByOrerunner(@RequestBody NrRecordsEntity nrRecords) throws ParseException {

		String currentDeptId = httpSessionService.getCurrentDeptId();

		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

		String deptId = nrRecords.getDeptId();
		String stationName = nrRecords.getStationName();

		LambdaQueryWrapper<NrDiggingsEndangerEntity> queryWrapperStationinfo = Wrappers.lambdaQuery();
		if (TsBqUtils.isNotNull(deptId)) {
			queryWrapperStationinfo.eq(NrDiggingsEndangerEntity::getTaxorgcode, deptId);
		} else {
			if (Constants.TAX_COUNTES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 县区局
				queryWrapperStationinfo.eq(NrDiggingsEndangerEntity::getTaxorgcode, currentDeptId);

			} else if (Constants.TAX_CITIES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 市局
				queryWrapperStationinfo.like(NrDiggingsEndangerEntity::getTaxorgcode, currentDeptId.substring(0, 5));
			} else {
				// 省局
			}
		}

		if (TsBqUtils.isNotNull(stationName)) {
			queryWrapperStationinfo.like(NrDiggingsEndangerEntity::getName, stationName);
		}
		
		List<NrDiggingsEndangerEntity> listNr = nrDiggingsEndangerService.list(queryWrapperStationinfo);
		
		List<String> nrIdList = new ArrayList<>();
		
		for (NrDiggingsEndangerEntity nr : listNr) {
			String id = nr.getId();
			nrIdList.add(id);
		}
		
		if (TsBqUtils.isNotNull(nrIdList)) {
			Page page = new Page(nrRecords.getPage(), nrRecords.getLimit());
			LambdaQueryWrapper<NrRecordsEntity> queryWrapper = Wrappers.lambdaQuery();
			// 查询条件示例
			
			if (!StringUtils.isEmpty(nrRecords.getCreateTimeStart())) {
				queryWrapper.ge(NrRecordsEntity::getTime,
						sdf.parse(nrRecords.getCreateTimeStart() + " 00:00:00"));
			}
			if (!StringUtils.isEmpty(nrRecords.getCreateTimeEnd())) {
				queryWrapper.le(NrRecordsEntity::getTime,
						sdf.parse(nrRecords.getCreateTimeEnd() + " 23:59:59"));
			}

			queryWrapper.eq(NrRecordsEntity::getMessageRulename, "转轮");
			
			queryWrapper.in(NrRecordsEntity::getNrEndanger, nrIdList);
			
			queryWrapper.orderByDesc(NrRecordsEntity::getTime);

			IPage<NrRecordsEntity> iPage = nrRecordsService.page(page, queryWrapper);
			List<NrRecordsEntity> records = iPage.getRecords();
			for (NrRecordsEntity nrRecordsEntity : records) {
				String nrEndanger = nrRecordsEntity.getNrEndanger();
				NrDiggingsEndangerEntity diggingsEndangerEntity = nrDiggingsEndangerService.getById(nrEndanger);
				if(TsBqUtils.isNotNull(diggingsEndangerEntity)){
					
					String diggingsEndangerName = diggingsEndangerEntity.getName();
					nrRecordsEntity.setStation(diggingsEndangerName);
					
					String taxorgcode = diggingsEndangerEntity.getTaxorgcode();
					SysDept sysDept = deptService.getById(taxorgcode);
					
					if(TsBqUtils.isNotNull(sysDept)){
						String name = sysDept.getName();
						nrRecordsEntity.setDeptName(name);
					}
					String taxpayerCode = diggingsEndangerEntity.getTaxpayerCode();
					nrRecordsEntity.setTaxpayerCode(taxpayerCode);
				}
			}
			return DataResult.success(iPage);
		}else{
			return DataResult.fail("暂无分析矿山业务数据");
		}
	}
	
	
	
	@ApiOperation(value = "查询分页数据")
	@PostMapping("/listhandle")
	@ResponseBody
	public DataResult listhandle(@RequestBody NrRecordsEntity nrRecords) throws ParseException {

		String currentDeptId = httpSessionService.getCurrentDeptId();
		String deptId = nrRecords.getDeptId();
		String stationName = nrRecords.getStationName();
		String industry = nrRecords.getIndustry();
		List<String> stationinfoIdList = new ArrayList<>();
		
		// 矿山
		LambdaQueryWrapper<NrDiggingsEndangerEntity> queryWrapperNrDiggingsEndanger = Wrappers.lambdaQuery();
		if(TsBqUtils.isNotNull(deptId)){
			queryWrapperNrDiggingsEndanger.eq(NrDiggingsEndangerEntity::getTaxorgcode, deptId);
		}else{
			if (Constants.TAX_COUNTES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 县区局
				queryWrapperNrDiggingsEndanger.eq(NrDiggingsEndangerEntity::getTaxorgcode, currentDeptId);

			} else if (Constants.TAX_CITIES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 市局
				queryWrapperNrDiggingsEndanger.like(NrDiggingsEndangerEntity::getTaxorgcode, currentDeptId.substring(0, 5));
			} else {
				// 省局
			}
		}
			
		if(TsBqUtils.isNotNull(stationName)){
			queryWrapperNrDiggingsEndanger.like(NrDiggingsEndangerEntity::getName, stationName);
		
		}
		
		if(TsBqUtils.isNotNull(industry)){
			queryWrapperNrDiggingsEndanger.eq(NrDiggingsEndangerEntity::getIndustry, industry);

		}
		List<NrDiggingsEndangerEntity> nrDiggingsList = nrDiggingsEndangerService.list(queryWrapperNrDiggingsEndanger);
		for (NrDiggingsEndangerEntity nrDiggingsEndangerEntity : nrDiggingsList) {
			String id = nrDiggingsEndangerEntity.getId();
			stationinfoIdList.add(id);
		}
		
		// 水泥和混凝土
		LambdaQueryWrapper<NrConcreteEndangerEntity> queryWrapperNrConcrete = Wrappers.lambdaQuery();
		
		if(TsBqUtils.isNotNull(deptId)){
			queryWrapperNrConcrete.eq(NrConcreteEndangerEntity::getTaxorgcode, deptId);
		}else{
			if (Constants.TAX_COUNTES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 县区局
				queryWrapperNrConcrete.eq(NrConcreteEndangerEntity::getTaxorgcode, currentDeptId);

			} else if (Constants.TAX_CITIES.equals(TsBqUtils.getTaxOrgLevel(currentDeptId))) {
				// 市局
				queryWrapperNrConcrete.like(NrConcreteEndangerEntity::getTaxorgcode, currentDeptId.substring(0, 5));
			} else {
				// 省局
			}
		}
		
		if(TsBqUtils.isNotNull(stationName)){
			queryWrapperNrConcrete.like(NrConcreteEndangerEntity::getName, stationName);
		}
		
		if(TsBqUtils.isNotNull(industry)){
			queryWrapperNrConcrete.eq(NrConcreteEndangerEntity::getIndustry, industry);

		}
		List<NrConcreteEndangerEntity> nrConcreteList = nrConcreteEndangerService.list(queryWrapperNrConcrete);
		for (NrConcreteEndangerEntity nrConcreteEndangerEntity : nrConcreteList) {
			String id = nrConcreteEndangerEntity.getId();
			stationinfoIdList.add(id);
		}
		
		// 查询企业
		if (TsBqUtils.isNotNull(stationinfoIdList)) {

			if (TsBqUtils.isNull(nrRecords.getCreateTimeStart())) {
				return DataResult.success("start-MessageDisappear不能为空！"); 
			}
			if (TsBqUtils.isNull(nrRecords.getCreateTimeEnd())) {
				return DataResult.success("end-MessageDisappear不能为空！");
			}
			
			nrRecords.setCreateTimeStart(nrRecords.getCreateTimeStart() + " 00:00:00");
			nrRecords.setCreateTimeEnd(nrRecords.getCreateTimeEnd() + " 23:59:59");
			nrRecords.setDeleted(0);

			int _page = nrRecords.getPage();
			int _limit = nrRecords.getLimit();

			if ((_page - 1) >= 1) {
				nrRecords.setPage((_page - 1) * _limit);
			} else {
				nrRecords.setPage(1);
			}

			List<NrRecordsEntity> records = nrRecordsService.listLimit(stationinfoIdList,
					nrRecords);
			List<NrRecordsEntity> count = nrRecordsService.listCount(stationinfoIdList,
					nrRecords);

			int total = 0;
			for (NrRecordsEntity entity : count) {
				String _count = entity.getCount();
				total += Integer.parseInt(_count);

			}

			IPage<NrRecordsEntity> _iPage = new Page<NrRecordsEntity>();
			int size = nrRecords.getLimit();
			if (total == 0) {
				_iPage.setPages(1);
			} else {
				BigDecimal a = new BigDecimal(total); // 被除数
				BigDecimal b = new BigDecimal(size); // 除数
				// 将除数乘以10，并保持小数点位置不变，以进一位
				BigDecimal adjustedDivisor = b.multiply(BigDecimal.TEN);
				// 执行除法
				BigDecimal result = a.divide(adjustedDivisor);
				_iPage.setPages(result.longValue());
			}

			_iPage.setCurrent(nrRecords.getPage());
			_iPage.setRecords(records);
			_iPage.setSize(size);
			_iPage.setTotal(total);

			for (NrRecordsEntity _nrRecords : records) {
				String nrEndanger = _nrRecords.getNrEndanger();
				GasStationinfoEntity gasStationinfoEntity = gasStationinfoService.getById(nrEndanger);

				_nrRecords.setStation(TsBqUtils.handleEndBeforeParentheses(gasStationinfoEntity.getName()));
				String taxorgcode = gasStationinfoEntity.getTaxorgcode();

				if (TsBqUtils.isNotNull(taxorgcode)) {
					String taxorgname = deptService.getById(taxorgcode).getName();
					_nrRecords.setDeptName(taxorgname);
				}
			}
			return DataResult.success(_iPage);

		} else {
			return DataResult.fail("暂无数据");
		}

	}
	
	
	

}
